package com.homer.gps.track.persist;

import java.util.Date;

import com.j256.ormlite.dao.ForeignCollection;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.field.ForeignCollectionField;
import com.j256.ormlite.table.DatabaseTable;

@DatabaseTable(tableName = "stops")
public class StopModel {
	public final static int STOP_TYPE_START = 0;
	public final static int STOP_TYPE_FINISH = 1;
	public final static int STOP_TYPE_OTHER = 2;
	
	public final static String ID_FIELD_NAME = "id";
	public final static String ID_FIELD_TYPE = "type";
	public final static String ID_FIELD_ROUTE_ID = "route_id";

	@DatabaseField(generatedId = true, columnName = ID_FIELD_NAME)
	private int id;
	
	@DatabaseField(canBeNull = false, columnName = ID_FIELD_TYPE)
	private int type;
	
	@DatabaseField(canBeNull = false)
	private Date startDateTime;
	
	@DatabaseField(canBeNull = true)
	private Date endDateTime;
	
	@DatabaseField(canBeNull = true)
	private String note;
	
	@DatabaseField(foreign = true, foreignAutoRefresh = true, columnName = ID_FIELD_ROUTE_ID)
	private RouteModel route;

	public StopModel() {
		// all persisted classes must define a no-arg constructor with at least package visibility
	}

	public int getId() {
		return this.id;
	}

	public int getType() {
		return type;
	}

	public void setType(int type) {
		this.type = type;
	}

	public String getNote() {
		return note;
	}

	public void setNote(String note) {
		this.note = note;
	}

	public void setId(int id) {
		this.id = id;
	}

	public RouteModel getRoute() {
		return route;
	}

	public void setRoute(RouteModel route) {
		this.route = route;
	}

	public Date getStartDateTime() {
		return startDateTime;
	}

	public void setStartDateTime(Date startDateTime) {
		this.startDateTime = startDateTime;
	}

	public Date getEndDateTime() {
		return endDateTime;
	}

	public void setEndDateTime(Date endDateTime) {
		this.endDateTime = endDateTime;
	}
}
